<?php $header=$this->action('ZfcAdmin\Controller\AdminController', 'headerAction');
	  $baseUrl = $header->headerarray['baseUrl'];
?>
<?php if(isset($_SESSION['admin'])){?>
		<div>
			<div>
				<div><h1>Add a user</h1></div>				
				<form id="regiserForm" name="regiserForm" method="post">
					<div>
						User Types: <select onclick="francheseShow()" id="user_type" name="user_type">
							<option value="">select a user type</option>
							<? if($this->allUsertypes->count()>0){ foreach($this->allUsertypes as $usertype){
								if($usertype->user_type!='admin'){?>
								<option value="<? echo $usertype->user_type_id;?>"><? echo $usertype->user_type;?></option>
								<?}}}else{?>
								<option value="">No types</option>
							<?}?>	
						</select>
					</div>
					</br>		
					<div>
					   User Name:<input type="text" id="inputUserName" name="inputUserName" placeholder="Please Enter UserName" size="30">
					</div>
					</br>
					<div>
					    Email Id:<input type="text" id="inputEmail" name="inputEmail" placeholder="Please Enter Email Id" size="30">
					</div>
					</br>
					<div>
					    Password:<input type="password" id="password" name="password" placeholder="Please Enter Password" size="30">
					</div>
					</br>
					<div>
						Phone Number:<input type="text" id="phoneNumber" name="phoneNumber" placeholder="Please Enter PhoneNumber" size="30">
					</div>
					<br/>
					<div>
						Address:<textarea  id="address" name="address" placeholder="Please Enter Address"></textarea>
					</div>
					<br/>
					<div id="franchesediv" style="display: none;">
						<div>
							District: <select id="districts" name="districts" onChange="return getDistrictAreas('admin_dist_areas','final');">
								<option value="">select a district</option>
								<? if($this->alldistricts){ foreach($this->alldistricts as $districts){?>
								<option value="<? echo $districts->district_id;?>"><? echo $districts->district_name;?></option>
								<?}}else{?>
								<option value="">No types</option>
							<?}?>	
							</select>
						</div>
						<br/>
						<div>
							Area:<select id="areas" name="areas" onChange="return getAreaBasedLocations('admin_area_locations')">
								<option value="">select a area</option>																
							</select>
						</div>
						<br/>
						<div>
							Location:<select id="location_id" name="location_id" >
								<option value="">select location</option>
							</select>
						</div>
						<br/>
					</div>
					<div class="controls">
						<button type="button" onClick="return adduserValidations('admin')">Save</button>&nbsp;&nbsp;&nbsp;<a href="<? echo $baseUrl.'admin/user-lists'?>">Back</a>
						</div>
					<input type="hidden" id="mod_type" name="mod_type" value="reg_admin">
				</form>
			</div>
		</div>
<?}else{?>
<script>
	window.location=ADMIN_BASE_URL+'admin';
</script>
<?}?>